package com.kk.mybatis.service;

import com.kk.mybatis.entity.Material;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

public interface MaterialService {

    /**
     * 分页查询素材并按更新日期降序
     * @param labelId
     * @param pageNum
     * @param limit
     * @return List<Material>
     */
    List<Material> listMaterials(int labelId, int pageNum, int limit);

    /**
     * 统计某标签下的素材数量
     * @param labelId
     * @return
     */
    int countMaterial(int labelId);

    /**
     * 通过Excel批量插入
     * @param file
     * @param materialService
     */
    void saveExcel(MultipartFile file, MaterialService materialService);

    /**
     * 导出所有素材
     * @param type
     */
    void exportExcel(int type);

    /**
     * 模糊查询素材
     * @param keyword
     * @param pageNum
     * @param limit
     * @return
     */
    Map<Integer, List<Material>> listMaterialsByKeyword(String keyword, int pageNum, int limit);

    @Transactional
    boolean saveBatch(List<Material> materials);

    void save(Material material);

    boolean removeById(int mId);

    boolean removeByIds(List<Integer> mIds);
}
